#include <iostream>
#include <queue>
using namespace std;

int main()
{
    queue<int> q;
    // //入队
    // q.push(23);
    // //访问队首元素
    // q.front();

    for(int i = 1; i <= 31; i++)
    {
        q.push(i);
    }

    int count = 0;
    while(q.size() > 1)
    {
        count++;
        int num = q.front();
        q.pop();
        if(count == 3)
        {
            cout<<num<<"出局\n";
            count = 0;
        }
        else
        {
            q.push(num);
        }
    }
    cout<<q.front()<<"存活下来\n";

    //优先队列
    priority_queue<int> q1;

}